#include <stdio.h>
#include <string.h>
#include <unistd.h>

enum{
  Sucess = 0,
  Div_Zero,
  Mod_Zero,
};



int exit_code = 0;


const char* CodeToErrString(int code)
{
  switch(code)
  {
    case Sucess:
      return "Success";
    case Div_Zero:
      return "Div zero";
    case  Mod_Zero:
      return  "mod zero";
    default:
      return  "uknow  error";
  }
}


int Div(int x,int y)
{
  if(0 == y)
  {
    return -1;
  }
  else 
    return  x/y;
}


int main()
{

  int result = Div(10,0);
  printf("result:%d [%s]\n",result,CodeToErrString(exit_code));

   result = Div(10,100);
  printf("result:%d [%s]\n",result,CodeToErrString(exit_code));
 
  
   result = Div(10,0);
  printf("result:%d [%s]\n",result,CodeToErrString(exit_code));
  
  return exit_code;
  //  for(int erroecode = 0; erroecode <= 255 ; erroecode++)
//  {
//    printf("%d: %s\n",erroecode,strerror(erroecode));
//  }
//
 // printf("I am process,pid: %d,ppid: %d\n",getpid(),getppid());
 // 
  sleep(2);
  return 120;
}
